package com.example.springboot.config.amqp.rabbitmq.fanoutconsumer;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 绑定fanout的交换机
 *
 * @Author:ChenZhangKun
 * @Date: 2021/1/2 23:24
 */
@Component
public class FanoutListener {
    @RabbitListener(bindings = @QueueBinding(value = @Queue,  // 创建临时队列
            exchange = @Exchange(value = "exchange.fanout", type = "fanout"))) // 指定交换机名称和类型
    public void receive(String message) {
        System.out.println(message + "=====================kevein");
    }
}
